<?php

$this->_toolbar = array(
		'title'		=>	Yii::t('admin_news', 'News Manager'),
		'buttons'	=>	array(
			CHtml::link(Yii::t('app','Delete'), "", array("id"=>"delete", "class"=>"button-s del", "onclick"=>"deleteAll('".Yii::app()->createUrl('/admin_news/news/delMulti')."','".Yii::t('app','Are you sure you want to delete item?')."')")),
			CHtml::link(Yii::t('app','Advanced Search'), "",array("id"=>"search", "class"=>"search-button button-s")),
		)
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('news-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<div class="search-form">
<?php $this->renderPartial('_search', array(
	'model' => $model,
)); ?>
</div><!-- search-form -->

<?php
$this->widget('ext.widgets.iGridView', array(
	'id' => 'news-grid',
	'dataProvider' => $model->search(),
	'filter' => $model,
	'columns' => array(
		array(
			'type'	=>	'raw',
			'header'	=>'<div id="sl-row" onclick="checkAll(this.id);" status="1">Check</div>',
			'htmlOptions'	=>	array(
				'width'	=>	'50',
				'align'	=>	'center',
			),
			'value'	=>	'CHtml::checkBox("rad_ID[]", "", array("value"=>$data->id))'
		),
		array(
			'name'	=>	'title',
			'type'	=>	'raw',
			'value'	=>	'CHtml::link(CHtml::encode($data->title), array("news/update","id"=>$data->id))'
		),
		array(
			'name'	=>	'status',
			'type'	=> 	'raw',
			'value'	=>	'CHtml::image(Yii::app()->theme->baseUrl."/images/icons/".Lookup::item("PostStatus",$data->status).".png",Lookup::item("PostStatus",$data->status), array("title"=>Lookup::item("PostStatus",$data->status)))',
			'htmlOptions'=>array(
				'align'	=>'center',
				'width'	=>'100'
			),
			'filter'=> Lookup::items('PostStatus')
		),
		array(
			'name'	=>	'catid',
			'value'	=>	'Categories::getNameCat($data->catid)',
			'filter'=>	CHtml::listData(Categories::model()->findAll('published=:p ORDER BY position ASC', array(':p'=>1)), "id", "title_tree")	
		),
		
		/*
		'created',
		'created_by',
		'modified',
		'modified_by',
		'ordering',
		'metakey',
		'metadesc',
		array(
					'name' => 'published',
					'value' => '($data->published == 0) ? Yii::t(\'app\', \'No\') : Yii::t(\'app\', \'Yes\')',
					'filter' => array('0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')),
					),
		*/
		array(
			'class' => 'CButtonColumn',
		),
		array(
			'name'	=>	'id',
			'htmlOptions'	=>	array(
				'width'	=>	'30',
				'align'	=>	'center'
			),
		),
	),
)); ?>